(function () {
    let aInputs = document.querySelectorAll("input")

    aInputs[4].addEventListener("click", function () {
        let data = {
            username: aInputs[0].value,
            password: aInputs[1].value,
            rpassword: aInputs[2].value,
            nickname: aInputs[3].value,
        };
        AP("/users/register", data).then((resData) => {
            if (resData.data.code == 1) {
                location.href = "login.html";
            } else {
                alert("注册失败");
            }
        });
    })
})()